<? include("./connection.php");
		
	if (isset($_REQUEST["Votar"])){
		$connection=mysql_connect($server, $user, $passwd);
		$db= mysql_select_db($name_db, $connection);
		if($_REQUEST["resposta"]=="si") {
			$si=1;
			$no=0;
		} else {
			$si=0;
			$no=1;
		}
		$sql="INSERT INTO '". $name_db."' (`si`, `no`) VALUES ('". $si."', '". $no."')";
		mysql_query($sql,$connection);
		mysql_close($connection);
	}
?>
<html>
<head>
	<title>Enquesta</title>
</head>
<body>

		<form action="enquesta.php" method="POST">
			<h1>Es millor el Google Nexus 4 o el Samsung galaxy 3?</h1>
			Google nexus 4	<input type="radio" name="resposta" value="si"><br>
			Samsung galaxy 3	<input type="radio" name="resposta" value="no"><br>
			<input type="submit" name="Votar" value="Votar">	
		</form>
		<a href="./resultats.php">Resultats</a>
</body>
</html>